package util;

import java.util.*;

/**
 * 红黑树测试
 * @Author tuyou_cd
 * @Date 2020/8/11 11:04
 */
public class TreeMapTest {

    public static void main(String[] args) {

        TreeMap<Integer, Integer> treemap = new TreeMap();
//        List<Integer> keyList = new ArrayList();
        List<Integer> keyList = new ArrayList<>(Arrays.asList(37, 16, 88, 90, 4, 26, 8, 35, 77, 96));
        int count = 10;
        Random random = new Random();
        for (int i = 0; i < count; i++) {
//            int key = random.nextInt(100);
//            keyList.add(key);
            int key = keyList.get(i);
            treemap.put(key, i);
        }

        System.out.println(keyList);
        System.out.println(treemap);

//        for (int i = 0; i < count; i++) {
//            int key = keyList.remove(random.nextInt(keyList.size()));
//            treemap.remove(key);
//        }

        treemap.remove(37);
    }
}
